<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://" + request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
	request.setAttribute("path", basePath);
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>用户注册</title>
<script type="text/javascript">
function checkUserName(){
	var userNameEle=document.getElementById("userName");
	if(userNameEle.value==""){
		alert("用户名不能为空");
		return false;
	}else{
		return true;
	}
}
function checkPassword(){
	var passEle=document.getElementById("password");
	if(passEle.value==""){
		alert("密码不能为空");
		return false;
	}
	var passConfirmEle=document.getElementById("passwordConfirm");
	if(passConfirmEle.value==""){
		alert("密码不能为空");
		return false;
	}
	
	if(passConfirmEle.value!=passEle.value){
		alert("密码不一致");
		return false;
	}
	
	return true;
}
function checkPhone(){
	var phoneEle=document.getElementById("phone");
	if(phoneEle.value==""){
		alert("电话不能为空");
		return false;
	}else{
		return true;
	}
}

function checkSubmit(){
	alert("jflsg");
	//checkUserName();
	//checkPassword();
	//checkPhone();
	if(checkUserName()&&checkPassword()&&checkPhone()){
		document.getElementById('signUp').submit();
	}
	
}

</script>
</head>
<body>
	<form action="<%=path%>/user/signUp.do?position=web" method="post" id="signUp">
		<table>
			<tr>
				<td>用户名</td>
				<td><input type="text" id="userName" name="userName" /></td>
			</tr>
			<tr>
				<td>设置密码</td>
				<td><input type="text" id="password" name="password" /></td>
			</tr>
			<tr>
				<td>确认密码</td>
				<td><input type="text" id="passwordConfirm"
					name="passwordConfirm" /></td>
			</tr>
			<tr>
				<td>性别</td>
				<td><select id="sex" name="sex">
						<option value="boy">男</option>
						<option value="girl">女</option>
				</select></td>
			</tr>
			<tr>
				<td>电话号码</td>
				<td><input type="text" id="phone" name="phone" /></td>
			</tr>
			<tr>
				<td colspan="2"><input type="button" value="立即注册"  onclick="checkSubmit()"/></td>
			</tr>
		</table>
	</form>
</body>
</html>